package routers

import (
	"ginstu/controllers/admin"
	"net/http"

	"github.com/gin-gonic/gin"
)

func AdminRoutersInit(r *gin.Engine) {
	adminRouters := r.Group("/admin")
	{
		// controller 抽离  admin.Useradmin == > controller - admin - usercontroller
		// 新增: 设置cookie
		adminRouters.GET("/", admin.UserController{}.Admin)
		adminRouters.GET("/user", admin.UserController{}.List)
		adminRouters.GET("/article", func(ctx *gin.Context) {
			ctx.JSON(http.StatusOK, gin.H{
				"title": "后台新闻",
			})
		})
		adminRouters.POST("/singleUpload", admin.UserController{}.SingleUpload)
		adminRouters.POST("/multiUpload1", admin.UserController{}.MultiUpload1)
		adminRouters.POST("/multiUpload2", admin.UserController{}.MultiUpload2)
		adminRouters.POST("/uploadGroup", admin.UserController{}.UploadGroup)
		adminRouters.GET("/getCookie", admin.UserController{}.GetCookie)
	}

}
